package com.lagou.goods.controller;

import Com.lagou.common.pojo.Goods;
import com.lagou.goods.service.GoodsService;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.persistence.criteria.CriteriaBuilder;


@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @GetMapping("/query/{id}")
    public Goods queryById(@PathVariable Integer id){
        return goodsService.queryById(id);
    }

    @DeleteMapping("/delete/{id}")
    public void delById(@PathVariable Integer id){
        goodsService.delById(id);
    }

    @PutMapping("/update")
    public String update(Goods goods){
        goodsService.updateByPrimaryKey(goods);
        return "修改成功";
    }



}
